/**
 * 
 */
package org.insia.smartposse.metier.webservice;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.insia.smartposse.metier.CategoryTheme;
import org.insia.smartposse.metier.Project;
import org.insia.smartposse.metier.ProjectSkill;

/**
 * @author raguerri
 * @since 18 avr. 07
 * @version 0.0.1
 * 
 */
public class LightProject 
implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5008920060547168694L;
	private long id;
	private long creator;
	private long budget;
	private String title;
	private Date start_date;
	private Date end_date;
	private String description;
	private String url;
	
	private List<LightProjectSkill> projectSkills = new ArrayList<LightProjectSkill>();
	private List<LightCategoryTheme> projectCategory = new ArrayList<LightCategoryTheme>();
	
	/**
	 * 
	 *
	 */
	public LightProject() {}
	
	/**
	 * 
	 * @param proj
	 */
	public LightProject (Project proj) {
		id = proj.getId();
		title = proj.getTitle();
		start_date = proj.getStart_date();
		end_date = proj.getEnd_date();
		description = proj.getDescription();
		creator = proj.getCreator().getId();
		budget = proj.getBudget();
		url = proj.getUrl();
		
		if (proj.getProjectSkills().size() != 0) {
			for (ProjectSkill pros : proj.getProjectSkills()) {
				projectSkills.add(pros.setLight());
			}
		}
		if (proj.getProjectCategory().size() != 0) {
			for (CategoryTheme catt : proj.getProjectCategory()) {
				projectCategory.add(catt.setLight());
			}
		}
	}

	/**
	 * @return the budget
	 */
	public long getBudget() {
		return budget;
	}

	/**
	 * @return the creator
	 */
	public long getCreator() {
		return creator;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the end_date
	 */
	public Date getEnd_date() {
		return end_date;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}

	/**
	 * @return the projectSkills
	 */
	public List<LightProjectSkill> getProjectSkills() {
		return projectSkills;
	}

	/**
	 * @return the start_date
	 */
	public Date getStart_date() {
		return start_date;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param budget the budget to set
	 */
	public void setBudget(long budget) {
		this.budget = budget;
	}

	/**
	 * @param creator the creator to set
	 */
	public void setCreator(long creator) {
		this.creator = creator;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param end_date the end_date to set
	 */
	public void setEnd_date(Date end_date) {
		this.end_date = end_date;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @param projectSkills the projectSkills to set
	 */
	public void setProjectSkills(List<LightProjectSkill> projectSkills) {
		this.projectSkills = projectSkills;
	}

	/**
	 * @param start_date the start_date to set
	 */
	public void setStart_date(Date start_date) {
		this.start_date = start_date;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the projectCategory
	 */
	public List<LightCategoryTheme> getProjectCategory() {
		return projectCategory;
	}

	/**
	 * @param projectCategory the projectCategory to set
	 */
	public void setProjectCategory(List<LightCategoryTheme> projectCategory) {
		this.projectCategory = projectCategory;
	}
}